﻿<!--
 Copyright © 2011 Nokia Corporation. All rights reserved.
 Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. 
 Other product and company names mentioned herein may be trademarks
 or trade names of their respective owners. 
 See LICENSE.TXT for license information.
-->
<phone:PhoneApplicationPage 
    x:Class="wpweeklyplanner.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:custom="clr-namespace:wpweeklyplanner;assembly=wpweeklyplanner"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800" 
    d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"
    shell:SystemTray.IsVisible="False">

    <!-- TransitionService is part of Silverlight Toolkit which does not ship as part of this
         example. Please see release notes for instructions how to install and use Silverlight Toolkit. -->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    
    <phone:PhoneApplicationPage.Resources>

        <Style x:Key="WeeklyPivotStyle" TargetType="controls:Pivot">
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <Grid/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:Pivot">
                        <Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache" Grid.RowSpan="4"/>
                            <ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}" Content="{TemplateBinding Title}" Margin="24,17,0,-7"/>
                            <controlsPrimitives:PivotHeadersControl x:Name="HeadersListElement" Grid.Row="1">
                                <controlsPrimitives:PivotHeadersControl.ItemContainerStyle>
                                    <Style TargetType="controlsPrimitives:PivotHeaderItem">
                                        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeExtraExtraLarge}"/>
                                        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiLight}"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="controlsPrimitives:PivotHeaderItem">
                                                    <Grid>
                                                        <VisualStateManager.VisualStateGroups>
                                                            <VisualStateGroup x:Name="SelectionStates">
                                                                <VisualState x:Name="Unselected"/>
                                                                <VisualState x:Name="Selected">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Foreground)" Storyboard.TargetName="headerText">
                                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TitleColor1Brush}">
                                                                            </DiscreteObjectKeyFrame>
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>
                                                            </VisualStateGroup>
                                                        </VisualStateManager.VisualStateGroups>
                                                        <TextBlock x:Name="headerText"
                                                                   Text="{TemplateBinding Content}"
                                                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                   Margin="{TemplateBinding Padding}"
                                                                   Foreground="{StaticResource TitleColor2Brush}"/>
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </controlsPrimitives:PivotHeadersControl.ItemContainerStyle>
                            </controlsPrimitives:PivotHeadersControl>
                            <!-- Top line -->
                            <Rectangle Grid.Row="2" Fill="{StaticResource PivotTitleLineBrush}" HorizontalAlignment="Stretch"
                                       Height="3"/>
                            <ItemsPresenter x:Name="PivotItemPresenter" Grid.Row="3"
                                            Margin="{TemplateBinding Padding}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
    </phone:PhoneApplicationPage.Resources>
    
    <Grid x:Name="LayoutRoot" Background="Transparent" Margin="12,0,6,0">
        <controls:Pivot x:Name="PivotRoot"
                        Style="{StaticResource WeeklyPivotStyle}"
                        Foreground="{StaticResource AppTitleBrush}"
                        Title="{Binding Path=LocalizedResources.AppTitle, Source={StaticResource LocalizedStrings}}"
                        ItemsSource="{Binding}">
            <controls:Pivot.Background>
                <ImageBrush ImageSource="/Content/background01.png" />
            </controls:Pivot.Background>
            <controls:PivotItem  Header="monday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller0">
                    <custom:WeeklyGrid x:Name="Grid0"
                                       DayOfWeek="0"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem>
            <controls:PivotItem Header="tuesday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller1">
                    <custom:WeeklyGrid x:Name="Grid1"
                                       DayOfWeek="1"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem>
            <controls:PivotItem Header="wednesday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller2">
                    <custom:WeeklyGrid x:Name="Grid2"
                                       DayOfWeek="2"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem>

            <controls:PivotItem Header="thursday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller3">
                    <custom:WeeklyGrid x:Name="Grid3"
                                       DayOfWeek="3"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem >
            <controls:PivotItem Header="friday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller4">
                    <custom:WeeklyGrid x:Name="Grid4"
                                       DayOfWeek="4"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem>
            <controls:PivotItem Header="saturday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller5">
                    <custom:WeeklyGrid x:Name="Grid5"
                                       DayOfWeek="5"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem>

            <controls:PivotItem Header="sunday" Margin="0,0,0,0">
                <ScrollViewer x:Name="Scroller6">
                    <custom:WeeklyGrid x:Name="Grid6"
                                       DayOfWeek="6"
                                       AddEvent="AddEvent"
                                       SelectEvent="SelectEvent"
                                       EditEvent="EditEvent"
                                       RemoveEvent="RemoveEvent"/>
                </ScrollViewer>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
    
</phone:PhoneApplicationPage>